﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using OgilvyOne.BLL;
using OgilvyOne.Model;

public partial class admin_infomation_article_comment_detail : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int aid = int.Parse(Request.Params["COMMENT_ID"]);
            this.headers.Text = new ColumnBll().LayeridColumnConNaiv(layerid);
            string url = "article_comment_detail.aspx?COMMENT_ID=" + Request.Params["COMMENT_ID"] + "&layerid=" + Request.Params["layerid"];
            this.headers.Text += "<img src='../images/subnav_dot.gif' width='9' height='9' />&nbsp;&nbsp;<a href='" + url + "'>文章评论详情</a>&nbsp;&nbsp";
            CmsArticleCommentModel cacm = new ICmsArticleComments().GetArticleCommentModel(aid);
            this.TextBox1.Text = cacm.Title;
            this.TextBox2.Text = cacm.CommentContent;
            this.TextBox3.Text = cacm.MemberNickname;
            this.TextBox4.Text = cacm.CommentTime.ToString("yyyy-MM-dd");
            bool bl = PopedomValidateHtml(layerid, PUB);
            if (bl)
            {
                this.state.Visible = true;
                if (cacm.State == 1)
                {
                    this.RadioButton1.Checked = true;
                }
                else
                {
                    this.RadioButton2.Checked = true;
                }
            }
            else
            {
                this.state.Visible = false;
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("article_comment_list.aspx?layerid=" + Request.Params["layerid"]);
        return;
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        int aid = int.Parse(Request.Params["COMMENT_ID"]);
        if (this.RadioButton1.Checked == true)
        {
            bool bo = new ICmsArticleComments().Pubsh(aid, 1);
            if (bo)
            {
                Page.RegisterStartupScript("成功", "<script>alert('已发布！');</script>");
            }
            else
            {
                Page.RegisterStartupScript("失败", "<script>alert('发布失败！');</script>");
            }
        }
        else
        {
            bool bo = new ICmsArticleComments().Pubsh(aid, 0);
            if (bo)
            {
                Page.RegisterStartupScript("成功", "<script>alert('撤消发布成功！');</script>");
            }
            else
            {
                Page.RegisterStartupScript("失败", "<script>alert('撤消发布失败！');</script>");
            }
        }
    }
}
